<?php
    require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/Service/CustomerService.php';
    require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/Entity/Domain/CustomerDomain.php';
    require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/Context/BaseContext.php';
    require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/ServiceResult/ServiceResult.php';
    $customerServices = new CustomerServices();
   
	
		$context = new BaseContext();
		$result = new ServiceResult();
		$customerArr = $customerServices->getAllCustomer($context, $result);
	?>
	<script type="text/javascript">
		$(document).ready(function () {
			
			$('#tableCus tr').click(function () {
				var text = $(this).find("td").eq(1).html();
	        	var value = $(this).find("td").eq(0).html();
	        	var comm =  $(this).find("td").eq(2).html();  	
	        	$("#consigneeText").html($.trim(text));	        	
	        	$("#consigneeValue").attr("value",$.trim(value));
	        	$("#commission").attr("value",$.trim(comm));
	        	removeAllProduct();
	        	dialog.remove(); 
			});
		});
	</script>
	<table border="1" id="tableCus" width="100%" >
	<?php 
		foreach ($customerArr as $customer)
		{
	?>
			<tr>
				<td>
					<?php echo $customer->getUserDomain()->getID(); ?>
				</td>
				<td>
					<?php echo $customer->getCustomerDomain()->getCustomerName() . " - " . $customer->getCustomerDomain()->getAddress() ; ?>
				</td>
				<td>
					<?php echo $customer->getCustomerDomain()->getComm() ; ?>
				</td>				
			</tr>
	<?php 
		}
	?>
	</table>
